Skip to content

WIP: SWTBot test case: ESP-IDF Manager Editor verification#1491

Open
AndriiFilippov wants to merge 1 commit into
masterfrom
IEP-1796
Open

WIP: SWTBot test case: ESP-IDF Manager Editor verification#1491
AndriiFilippov wants to merge 1 commit into
masterfrom
IEP-1796

Conversation

@AndriiFilippov

@AndriiFilippov AndriiFilippov commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change and which issue is fixed.

Fixes # (IEP-1796)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Component 1
  • Component 2

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Tests
    • Added comprehensive automated coverage for the ESP-IDF Manager, including installed-version display, active version detection, environment refresh, and completion feedback.
    • Added validation that build environment variables match the active ESP-IDF installation across supported operating systems.
    • Updated test configurations to resolve the ESP-IDF tools installation path consistently in CI environments.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test suite adds platform-specific ESP-IDF tools-path configuration and a new SWTBot test covering the ESP-IDF Manager editor, environment refresh completion, and consistency between active installation details and C/C++ build environment variables.

Changes

ESP-IDF Manager UI coverage

Layer / File(s) Summary
Platform tools-path configuration
tests/com.espressif.idf.ui.test/configs/default-test-*.properties
Linux and Windows configurations define default.env.idf.tools.path for ESP-IDF tools installation resolution.
Manager editor and refresh flow
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java
Adds SWTBot setup, manager navigation, installed-version and active-installation assertions, environment refresh polling, console checks, and cleanup helpers.
Build environment validation
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java
Validates IDF-related build variables against the active installation with OS-specific path construction and normalization.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EspIdfManagerTest
  participant IDE
  participant ESP-IDF Manager
  participant Console
  participant Preferences

  EspIdfManagerTest->>IDE: Open ESP-IDF Manager
  IDE->>ESP-IDF Manager: Display installed versions
  EspIdfManagerTest->>ESP-IDF Manager: Refresh environment
  ESP-IDF Manager->>Console: Report tools setup
  Console-->>EspIdfManagerTest: Return setup markers
  EspIdfManagerTest->>Preferences: Open build environment
  Preferences-->>EspIdfManagerTest: Return IDF variables
Loading

Possibly related PRs

Suggested reviewers: alirana01, kolipakakondal

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding an SWTBot test for ESP-IDF Manager editor verification.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch IEP-1796

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/com.espressif.idf.ui.test/configs/default-test-linux.properties`:
- Around line 16-18: The default-test-linux configuration currently overrides
the documented local tools path with a value derived from an unset
GITHUB_WORKSPACE. Update DefaultPropertyFetcher to apply this CI-only path only
when GITHUB_WORKSPACE is set, otherwise preserve the existing ~/.espressif/tools
fallback; alternatively, remove or conditionally exclude this property for local
Linux execution.

In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java`:
- Around line 177-201: Update thenToolsSetupCompletesInConsole and its setup
flow to track the current console run rather than relying on
toolsSetupCompleteCountBeforeAction across console clears. After refresh opens
or clears the tools console, wait for the new “Setting up IDE environment” and
“Tools Setup complete” messages in that run, preserving the existing completion
wait behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb7b2b71-9654-469f-a8a5-3cee1fb8eed2

📥 Commits

Reviewing files that changed from the base of the PR and between 3504879 and 73b1c53.

📒 Files selected for processing (3)
  • tests/com.espressif.idf.ui.test/configs/default-test-linux.properties
  • tests/com.espressif.idf.ui.test/configs/default-test-win.properties
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java

Comment on lines +16 to +18
# ESP-IDF tools installation directory used by EspIdfManagerTest
# Linux CI uses GITHUB_WORKSPACE placeholder; local Linux default is ~/.espressif/tools
default.env.idf.tools.path={0}/dependencies/idf-tools

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the local tools-path fallback.

When GITHUB_WORKSPACE is unset, DefaultPropertyFetcher expands this to null/dependencies/idf-tools rather than the documented ~/.espressif/tools. Handle the missing environment variable in the fetcher or avoid applying this CI-only property locally.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/com.espressif.idf.ui.test/configs/default-test-linux.properties` around
lines 16 - 18, The default-test-linux configuration currently overrides the
documented local tools path with a value derived from an unset GITHUB_WORKSPACE.
Update DefaultPropertyFetcher to apply this CI-only path only when
GITHUB_WORKSPACE is set, otherwise preserve the existing ~/.espressif/tools
fallback; alternatively, remove or conditionally exclude this property for local
Linux execution.

Comment on lines +177 to +201
toolsSetupCompleteCountBeforeAction = countOccurrences(getConsoleText(toolsConsole),
TOOLS_SETUP_COMPLETE);

SWTBotButton refreshButton = editor.bot().button(REFRESH_ENVIRONMENT_BUTTON);
assertTrue("Refresh Environment must be enabled before clicking it", refreshButton.isEnabled()); //$NON-NLS-1$
refreshButton.click();

waitForToolsSetupToStart(editor, toolsConsole, REFRESH_ENVIRONMENT_BUTTON);
}

static void thenToolsSetupCompletesInConsole()
{
SWTBotView toolsConsole = ProjectTestOperations.viewConsole(TOOLS_CONSOLE_NAME, bot);
toolsConsole.show();
toolsConsole.setFocus();

final int expectedMinimumCount = toolsSetupCompleteCountBeforeAction + 1;
toolsConsole.bot().waitUntil(new DefaultCondition()
{
@Override
public boolean test() throws Exception
{
String consoleText = getConsoleText(toolsConsole);
return countOccurrences(consoleText, TOOLS_SETUP_COMPLETE) >= expectedMinimumCount
&& consoleText.contains(SETTING_UP_IDE_ENVIRONMENT);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C4 'clearConsole|TOOLS_SETUP_COMPLETE|Tools Setup complete|Setting up IDE environment' \
  --type java tests bundles

Repository: espressif/idf-eclipse-plugin

Length of output: 12665


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- IDFConsole.java ---'
sed -n '1,120p' bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java

echo
echo '--- SetupToolsInIde.java (setup logging) ---'
sed -n '130,175p' bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/SetupToolsInIde.java

echo
echo '--- EspIdfManagerTest.java around refresh/wait helpers ---'
sed -n '150,230p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java

echo
echo '--- EspIdfManagerTest.java around related console assertions ---'
sed -n '340,390p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java

Repository: espressif/idf-eclipse-plugin

Length of output: 9279


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- Refresh-related references ---'
rg -n -C3 'Refresh Environment|refresh.*environment|setupTools|Tools Console|createToolsConsole|clearConsole\(' \
  bundles tests -g '*.java'

echo
echo '--- EspIdfManagerTest.java full helper area ---'
sed -n '1,260p' tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java

echo
echo '--- IDFConsole.java full file ---'
sed -n '1,220p' bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java

Repository: espressif/idf-eclipse-plugin

Length of output: 31985


Track the new console run instead of counting across clears: IDFConsole.getConsoleStream(...) clears Espressif IDF Tools Console before every setup, so toolsSetupCompleteCountBeforeAction + 1 can be impossible once refresh starts from a cleared console. Wait for the new Setting up IDE environment / Tools Setup complete pair in the current run, or reset the baseline after the refresh job opens the console.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/EspIdfManagerTest.java`
around lines 177 - 201, Update thenToolsSetupCompletesInConsole and its setup
flow to track the current console run rather than relying on
toolsSetupCompleteCountBeforeAction across console clears. After refresh opens
or clears the tools console, wait for the new “Setting up IDE environment” and
“Tools Setup complete” messages in that run, preserving the existing completion
wait behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant